USE [GD2C2013]
GO

/****** Object:  StoredProcedure [vacuna_gdd].[sp_compraBonos]    Script Date: 10/30/2013 22:54:16 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


CREATE PROCEDURE [vacuna_gdd].[sp_compraBonos]
		@cobo_id numeric,
        @cobo_afiliado_id NVARCHAR(50),
        @cobo_monto numeric,
        @cobo_plan numeric,
        @cobo_fecha_compra DATETIME
        
AS
    SET NOCOUNT ON
    BEGIN
        IF NOT exists(SELECT
                          *
                      FROM vacuna_gdd.Compra_bono
                      WHERE cobo_id = @cobo_id)
            BEGIN
                INSERT INTO vacuna_gdd.Compra_bono (cobo_id, cobo_afiliado_id, cobo_monto, cobo_plan, cobo_fecha_compra)
                    VALUES (@cobo_id, @cobo_afiliado_id, @cobo_monto, @cobo_plan, @cobo_fecha_compra)
            END
    END

GO


